<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4-5实现学生管理页面创建新用户的功能</title>
    <script src="https://unpkg.com/vue@3"></script>
</head>

<body>
    <div id="app" style="border: 1px solid lightblue;">
        <p>
            <label>用户名：</label><br />
            <input type="text" v-model="name">
        </p>
        <p>
            <label>年龄：</label><br />
            <input type="text" v-model="age">
        </p>
        <p>
            <label>性别</label><br />
            <select name="" id="" v-model="opt">
                <option value="男">男</option>
                <option value="女">女</option>
            </select>
        </p>
        <p>
            <button @click="newUser">创建新用户</button>
        </p>
    </div>
    <script>
        const { createApp } = Vue;
        createApp({
            data() {
                return {
                    name: '',
                    age: '',
                    opt: '',
                };
            },
            methods: {
                newUser: function () {
                    alert("用户名：" + this.name + "，年龄：" + this.age + "，性别：" + this.opt);
                }
            },
        }).mount("#app");
    </script>
</body>

</html>